USE [BMIG_Mensual_POST_CADENA]
GO

/****** Object:  StoredProcedure [dbo].[WASP_M0002_ULT_PAGO]    Script Date: 11/24/2011 14:37:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[WASP_M0002_ULT_PAGO]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[WASP_M0002_ULT_PAGO]
GO

USE [BMIG_Mensual_POST_CADENA]
GO

/****** Object:  StoredProcedure [dbo].[WASP_M0002_ULT_PAGO]    Script Date: 11/24/2011 14:37:58 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


CREATE PROCEDURE [dbo].[WASP_M0002_ULT_PAGO]
AS
BEGIN
	SELECT	ppsuc AS suc 
			,ppcta AS cta
			,ppoper AS oper
			,MAX(Pp1fech) AS ult_pago
	INTO	ult_pago
	FROM	fsd602 (NOLOCK)
	GROUP BY ppsuc
			,ppcta
			,ppoper
END

GO


